package com;

import com.beans.*;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * \* Created with IntelliJ IDEA.
 * \* User: Administrator
 * \* Date: 2022/7/16
 * \* Time: 22:43
 * \* To change this template use File | Settings | File Templates.
 * \* Description:
 * \
 */
public class App {
    public static void main(String[] args) {
        //1.获取Spring的上下文对象
        ApplicationContext context = new ClassPathXmlApplicationContext("spring-config.xml");
        //2.获取Bean
        //（1）使用Controller注解
      //  UserController userController = context.getBean(UserController.class);
        //（2）使用Service注解
       // UserService userService = context.getBean("userService",UserService.class);
        //(3)使用Repository注解
        //UserRepository userRepository = context.getBean("userRepository",UserRepository.class);

        //(4)使用@Configuration注解
       // UserConfiguration userConfiguration = context.getBean("userConfiguration",UserConfiguration.class);

        //(5)使用@Component注解
        //UserComponent userComponent = context.getBean("userComponent",UserComponent.class);

       // //(6)使用@Bean注解
       // UserBean userBean = context.getBean("")
        //3.调用Bean方法
        //userController.sayHi();
        //userService.sayHi();
        //userRepository.sayHi();
        //userConfiguration.sayHi();
       // userComponent.sayHi();
    }
}
